package net.sf.rose.business.bean.control;

import java.util.ArrayList;
import java.util.List;

import net.sf.rose.business.bean.control.judge.JudgeBean;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;

/**
 * @author fengjian
 * @since 2014-5-20
 */
public class TabBean {

	/** 标题 */
	@Attribute
	private String text = null;

	/** 权限配置 */
	@Element(required = false)
	private JudgeBean judge = null;

	/** 页签上所有的面板组件 */
	@ElementList(name = "panels", required = false)
	private List<PanelBean> panels = new ArrayList<PanelBean>();

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public List<PanelBean> getPanels() {
		return panels;
	}

	public void setPanels(List<PanelBean> panels) {
		this.panels = panels;
	}

	public PanelBean getPanel(String text) {
		for (PanelBean bean : panels) {
			if (bean.getText().equals(text)) {
				return bean;
			}
		}
		return null;
	}

	public void removePanel(String text) {
		for (PanelBean bean : panels) {
			if (bean.getText().equals(text)) {
				panels.remove(bean);
				return;
			}
		}
	}

	public JudgeBean getJudge() {
		return judge;
	}

	public void setJudge(JudgeBean judge) {
		this.judge = judge;
	}
}
